package org.jeecg.modules.iot.bind.service;

import com.alibaba.fastjson.JSONObject;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.iot.bind.entity.YlBindUser;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.iot.message.ReceivePopupIndex;
import org.jeecg.modules.iot.message.ReceivePopupSN;
import org.jeecg.modules.iot.message.ReceiveUpload;
import org.jeecg.modules.power.device.entity.YlDevice;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.List;

/**
 * @Description: 设备绑定操作员表
 * @Author: jeecg-boot
 * @Date:   2024-09-03
 * @Version: V1.0
 */
public interface IYlBindUserService extends IService<YlBindUser> {
    /**
     * 根据二维码的ID查询对应的设备信息，更新sn号
     * @param qrCodeId
     * @param rentBoxSn
     */
    void bindDevice(String qrCodeId,String rentBoxSn);
    void unbindDevice(String qrCodeId,String rentBoxSn);
    Result<?> accountLogin(YlBindUser sysUser);
    /**
     * 校验用户token
     * @param request
     * @return
     */
    YlBindUser getUserByToken(HttpServletRequest request);
    /**
     * 发送查询命令查询设备情况
     * @param qrcodeId
     * @return
     */
    JSONObject queryDevice(String qrcodeId);
    /**
     * sn号弹出
     * @param sn
     * @return
     */
    ReceivePopupSN popupSn(String deviceSn,String sn);
    /**
     * 孔位弹出
     * @param hole
     * @return
     */
    ReceivePopupIndex popupHole(String deviceSn, String hole, String io);

    /**
     * 生成设备信息
     * @param categoryId
     * @return
     */
    YlDevice getQrCodeId(String categoryId) throws IOException;

    /**
     * 删除未绑定的作废的设备
     * @param id
     * @return
     */
    void deleteDevice(String id);
    /**
     * 获取全部柜机类型
     * @return
     */
    List<JSONObject> getCategory();
    /**
     * 本地文件上传
     * @param bufferedImage 文件
     * @param bizPath  自定义路径
     * @return
     */
    String uploadLocal(BufferedImage bufferedImage, String bizPath) throws IOException;

    JSONObject jsonEntity(ReceiveUpload receiveUpload);
    JSONObject jsonEntity(ReceiveUpload receiveUpload,String deviceSn);

    ReceivePopupSN sendMsg(String deviceSn);
}
